package DesignMode.OCP;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}18:34
 */
public class ocp {
    public static void main(String[] args) {
        //使用存在的问题

    }
}

class GraphicEditor{
    public void drawShape(Shape shape){
        if (shape.m_type == 1){
            drawRectangle(shape);
        }else if (shape.m_type == 2){
            drawCircle(shape);
        }
    }

    public void drawRectangle(Shape shape){
        System.out.println("矩形");
    }

    public void drawCircle(Shape shape){
        System.out.println("圆形");
    }
}

class Shape{
    int m_type;
}

class Rectanle extends Shape{
    public Rectanle() {
        super.m_type = 1;
    }
}

class Circle extends Shape{
    public Circle() {
        super.m_type = 2;
    }
}